import request from '@/utils/request'

// 刷新设备
export function refreshDevice() {
  return request({
    url: '/tk/task',
    method: 'get'
  })
}
// 监测公司绑定查询 
export function getMonitorCompany(data) {
  return request({
    url: `/termite/queryMonitorCompany`,
    method: 'post',
    data: data
  })
}

// 绑定监测公司数据-增加
export function insertMonitorCompany(data) {
  return request({
    url: '/termite/insertMonitorCompany',
    method: 'post',
    data: data
  })
}
// 绑定监测公司数据-编辑
export function updateMonitorCompany(data) {
  return request({
    url: '/termite/updateMonitorCompany',
    method: 'post',
    data: data
  })
}

// 监测点管理数据查询
export function queryMonitorPoint(data) {
  return request({
    url: '/termite/queryMonitorPoint',
    method: 'post',
    data: data
  })
}

// 监测点管理数据查询单条数据
export function queryMonitorPointOne(id) {
  return request({
    url: `/termite/queryMonitorPointOne?pointId=${id}`,
    method: 'get'
  })
}

// 监测点数据增加
export function insertPointMonitor(data) {
  return request({
    url: '/termite/insertPointMonitor',
    method: 'post',
    data: data
  })
}

// 监测点数据编辑
export function updatePointMonitor(data) {
  return request({
    url: '/termite/updatePointMonitor',
    method: 'post',
    data: data
  })
}
// 监测点数据编辑(新)
export function updatePointMonitorNew(data) {
  return request({
    url: '/termite/updatePointMonitorNew',
    method: 'post',
    data: data
  })
}
// 有蚁列表中的顶部数据
export function termiteCountDataQuery() {
  return request({
    url: '/termite/termiteCountDataQuery',
    method: 'post'
  })
}

export function loadingMsg(params) {
  return request({
    url: '/termite/loadingMsg',
    method: 'get',
    params
  })
}
// 图片访问

export function safeImg(params) {
  return request({
    url: `/termite/msg`,
    // url: `/termite/safe/filename`,
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// 项目列表数据查询
export function queryProjectData(data) {
  return request({
    url: '/termite/queryProjectData',
    method: 'post',
    data: data
  })
}

// 新增项目
export function addProjectData(data) {
  return request({
    url: '/termite/addProjectData',
    method: 'post',
    data: data
  })
}
// 项目编辑
export function updateProjectData(data) {
  return request({
    url: '/termite/updateProjectData',
    method: 'post',
    data: data
  })
}

// 监测点数据删除(单个或批量)
export function delPointMonitorByIds(data) {
  return request({
    url: '/termite/delPointMonitorByIds',
    method: 'post',
    data: data
  })
}

// 报警短信查询
export function alarmMsgQuery(data) {
  return request({
    url: '/termite/alarmMsgQuery',
    method: 'post',
    data
  })
}
// 监测公司查询 
export function queryMonitorCompanyData(data) {
  return request({
    url: '/termite/queryMonitorCompanyData',
    method: 'post',
    data: data
  })
}

// 查询处理日志
export function queryHandleLog(data) {
  return request({
    url: '/termite/queryHandleLog',
    method: 'post',
    data
  })
}
// 项目列表-有蚁
export function queryMonitorPointTermite(data) {
  return request({
    url: '/termite/queryMonitorPointTermite',
    method: 'post',
    data: data
  })
}
// 有蚁列表->有蚁处理
export function termiteHandle(data) {
  return request({
    url: '/termite/termiteHandle',
    method: 'post',
    data: data
  })
}

// 监测防治公司解绑
export function monitorCompanyDataUnbind(data) {
  return request({
    url: '/termite/monitorCompanyDataUnbind',
    method: 'post',
    data
  })
}
// 项目删除(单个或批量)
export function delProjectDataByIds(data) {
  return request({
    url: '/termite/delProjectDataByIds',
    method: 'post',
    data
  })
}
// 外部接口 获取token
export function getToken(token) {
  return request({
    url: '/external/encryptGetUserDetail',
    method: 'get',
    headers: {
      'isToken': false
    },
    params: {
      userToken: token
    }
  })
}
// 外部接口 获取token（新）
export function getTokenNew(data) {
  return request({
    url: '/external/encryptGetUserDetail/new',
    method: 'post',
    headers: {
      'isToken': false
    },
    data
  })
}
// /termite/downloadDeviceDataTemplate
export function downloadDeviceDataTemplate() {
  return request({
    url: '/termite/downloadDeviceDataTemplate',
    method: 'get',
    responseType: 'blob'
  })
}
// /termite/downDeviceData
export function downloadDeviceData(data) {
  return request({
    url: '/termite/downDeviceData',
    method: 'post',
    data: data,
    responseType: 'blob'
  })
}
// 获取地图token
export function getURLWithToken(data) {
  return request({
    url: '/external/getURLWithToken',
    method: 'post',
    data
  })
}